package com.rjt.mail.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.rjt.common.util.CuccUtil;

@RestController
@RequestMapping("mail")
public class MailController {
	@Autowired
	private JavaMailSender mailSender;
	
	@Value("${spring.mail.username}")
	private String fromMail;
	
	@GetMapping("send")
	public String send(String subject,String content,String mail) {
		CuccUtil.sendSimpleMail(fromMail,subject,content, mail, mailSender);
		return "sucsess";
	}
}
